package com.practice.springboot.rabbitmqtest.controller;

import com.practice.springboot.rabbitmqtest.config.DirectRabbitConfig;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.PostConstruct;

/**
 * @Description : rabbitmq provider
 * @Author : guxuemin
 * @Version : V1.0.0
 * @Date : 2021/11/10 20:24
 */
@RestController
public class RabbitMqDirectProvider {

    @Autowired
    private RabbitTemplate rabbitTemplate;

    @GetMapping("sendDirectMsg")
    public void testDirect() {
        rabbitTemplate.convertAndSend(DirectRabbitConfig.TestDirectExchange,
                DirectRabbitConfig.TestDirectRouting, "test direct exchange");
    }
}
